package com.liusy.serachengine.parserFile;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import org.apache.log4j.Logger;

public class ParserText {
	private static Logger log=Logger.getLogger(ParserText.class.getName());
	   public static StringBuffer readTxt(String path) {
		      StringBuffer content = new StringBuffer("");// �ĵ����� 
		      try {
		    	  File f = new File(path);
			      if(!f.exists())return content;
		         FileReader reader = new FileReader(path);
		         BufferedReader br = new BufferedReader(reader);
		         String s1 = null;

		         while ((s1 = br.readLine()) != null) {
		            content.append(s1 + " ");
		         }
		         br.close();
		         reader.close();;
		      }
		      catch (IOException e) {
		    	  log.error("parser Text error:"+path,e);
		    	  System.out.println("��ȡ�ļ�"+path+"���ı����ݳ��?����������δ���ɹ���");
		      }
		      return content;
		   }
}
